package com.perfect.mybatis;

import com.perfect.mybatis.config.AppConfig;
import com.perfect.mybatis.services.UserServiceImpl;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Main {
    public static void main(String[] args) {


        try {
            AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
            applicationContext.register(AppConfig.class);
            applicationContext.refresh();

            UserServiceImpl userService = applicationContext.getBean(UserServiceImpl.class);
            System.out.println(userService.selectUserName());
            System.out.println(userService.selectNow());
        }catch (Exception e){
            e.printStackTrace();
        }

    }
}